package Entities;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "user_log_on", schema = "user_center", catalog = "")
public class UserLogOnEntity {
    private String id;
    private String userid;
    private String password;
    private String secretKey;
    private Timestamp allowStartTime;
    private Timestamp allowEndTime;
    private Timestamp lockStartDate;
    private Timestamp lockEndDate;
    private Timestamp firstVisitTime;
    private Timestamp previousVisitTime;
    private Timestamp lastVisitTime;
    private Timestamp changePasswordDate;
    private boolean multiUserLogin;
    private int logonCount;
    private boolean userOnline;
    private String question;
    private String answerQuestion;
    private String adder;
    private Timestamp addTime;
    private String modifier;
    private Timestamp modifyTime;

    @Id
    @Column(name = "id", nullable = false, length = 64)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "userid", nullable = false, length = 64)
    public String getUserid() {
        return userid;
    }

    public void setUserid(String userid) {
        this.userid = userid;
    }

    @Basic
    @Column(name = "password", nullable = false, length = 150)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "secret_key", nullable = false, length = 50)
    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    @Basic
    @Column(name = "allow_start_Time", nullable = false)
    public Timestamp getAllowStartTime() {
        return allowStartTime;
    }

    public void setAllowStartTime(Timestamp allowStartTime) {
        this.allowStartTime = allowStartTime;
    }

    @Basic
    @Column(name = "allow_end_time", nullable = false)
    public Timestamp getAllowEndTime() {
        return allowEndTime;
    }

    public void setAllowEndTime(Timestamp allowEndTime) {
        this.allowEndTime = allowEndTime;
    }

    @Basic
    @Column(name = "lock_start_date", nullable = false)
    public Timestamp getLockStartDate() {
        return lockStartDate;
    }

    public void setLockStartDate(Timestamp lockStartDate) {
        this.lockStartDate = lockStartDate;
    }

    @Basic
    @Column(name = "lock_end_date", nullable = false)
    public Timestamp getLockEndDate() {
        return lockEndDate;
    }

    public void setLockEndDate(Timestamp lockEndDate) {
        this.lockEndDate = lockEndDate;
    }

    @Basic
    @Column(name = "first_visit_time", nullable = false)
    public Timestamp getFirstVisitTime() {
        return firstVisitTime;
    }

    public void setFirstVisitTime(Timestamp firstVisitTime) {
        this.firstVisitTime = firstVisitTime;
    }

    @Basic
    @Column(name = "previous_visit_time", nullable = false)
    public Timestamp getPreviousVisitTime() {
        return previousVisitTime;
    }

    public void setPreviousVisitTime(Timestamp previousVisitTime) {
        this.previousVisitTime = previousVisitTime;
    }

    @Basic
    @Column(name = "last_visit_time", nullable = false)
    public Timestamp getLastVisitTime() {
        return lastVisitTime;
    }

    public void setLastVisitTime(Timestamp lastVisitTime) {
        this.lastVisitTime = lastVisitTime;
    }

    @Basic
    @Column(name = "change_password_date", nullable = false)
    public Timestamp getChangePasswordDate() {
        return changePasswordDate;
    }

    public void setChangePasswordDate(Timestamp changePasswordDate) {
        this.changePasswordDate = changePasswordDate;
    }

    @Basic
    @Column(name = "multi_user_login", nullable = false)
    public boolean isMultiUserLogin() {
        return multiUserLogin;
    }

    public void setMultiUserLogin(boolean multiUserLogin) {
        this.multiUserLogin = multiUserLogin;
    }

    @Basic
    @Column(name = "logon_count", nullable = false)
    public int getLogonCount() {
        return logonCount;
    }

    public void setLogonCount(int logonCount) {
        this.logonCount = logonCount;
    }

    @Basic
    @Column(name = "user_online", nullable = false)
    public boolean isUserOnline() {
        return userOnline;
    }

    public void setUserOnline(boolean userOnline) {
        this.userOnline = userOnline;
    }

    @Basic
    @Column(name = "question", nullable = true, length = 50)
    public String getQuestion() {
        return question;
    }

    public void setQuestion(String question) {
        this.question = question;
    }

    @Basic
    @Column(name = "answer_question", nullable = true, length = 500)
    public String getAnswerQuestion() {
        return answerQuestion;
    }

    public void setAnswerQuestion(String answerQuestion) {
        this.answerQuestion = answerQuestion;
    }

    @Basic
    @Column(name = "adder", nullable = true, length = 64)
    public String getAdder() {
        return adder;
    }

    public void setAdder(String adder) {
        this.adder = adder;
    }

    @Basic
    @Column(name = "add_time", nullable = false)
    public Timestamp getAddTime() {
        return addTime;
    }

    public void setAddTime(Timestamp addTime) {
        this.addTime = addTime;
    }

    @Basic
    @Column(name = "modifier", nullable = true, length = 64)
    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    @Basic
    @Column(name = "modify_time", nullable = false)
    public Timestamp getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Timestamp modifyTime) {
        this.modifyTime = modifyTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        UserLogOnEntity that = (UserLogOnEntity) o;
        return multiUserLogin == that.multiUserLogin &&
                logonCount == that.logonCount &&
                userOnline == that.userOnline &&
                Objects.equals(id, that.id) &&
                Objects.equals(userid, that.userid) &&
                Objects.equals(password, that.password) &&
                Objects.equals(secretKey, that.secretKey) &&
                Objects.equals(allowStartTime, that.allowStartTime) &&
                Objects.equals(allowEndTime, that.allowEndTime) &&
                Objects.equals(lockStartDate, that.lockStartDate) &&
                Objects.equals(lockEndDate, that.lockEndDate) &&
                Objects.equals(firstVisitTime, that.firstVisitTime) &&
                Objects.equals(previousVisitTime, that.previousVisitTime) &&
                Objects.equals(lastVisitTime, that.lastVisitTime) &&
                Objects.equals(changePasswordDate, that.changePasswordDate) &&
                Objects.equals(question, that.question) &&
                Objects.equals(answerQuestion, that.answerQuestion) &&
                Objects.equals(adder, that.adder) &&
                Objects.equals(addTime, that.addTime) &&
                Objects.equals(modifier, that.modifier) &&
                Objects.equals(modifyTime, that.modifyTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userid, password, secretKey, allowStartTime, allowEndTime, lockStartDate, lockEndDate, firstVisitTime, previousVisitTime, lastVisitTime, changePasswordDate, multiUserLogin, logonCount, userOnline, question, answerQuestion, adder, addTime, modifier, modifyTime);
    }
}
